﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SQLH2ConfigTool
{
    public class ServerCollection : System.Collections.CollectionBase
    {

        public virtual void Add(Server NewServer)
        {
            //forward our Add method on to 
            //CollectionBase.IList.Add 
            this.List.Add(NewServer);
        }

        //this is the indexer (readonly)
        public virtual Server this[int Index]
        {

            get
            {
                //return the Widget at IList[Index]
                return (Server)this.List[Index];
            }
        }

        public virtual Server this[string Name]
        {
            get
            {
                foreach (Server s in this.List)
                {
                    if (s.ServerName == Name)
                    {
                        return s;
                    }
                }
                return null;
            }
        }
    }
}
